package com.bloveoa.zkkd.util;

import java.math.BigDecimal;

/**
 * Created by yujunlong on 2016/12/16.
 */

public class NumberUtil {

    public static int getIntByStr(String data){
        int a = 0;
        try {
            a = Integer.valueOf(data);
        } catch (NumberFormatException e) {

        }
        return  a;
    }

    public static Long getLongByStr(String data){
        Long a = 0L;
        try {
            a = Long.valueOf(data);
        } catch (NumberFormatException e) {

        }
        return  a;
    }

    public static Double getDoubleByStr(String data){
        double a = 0;
        if(StringUtils.isEmpty(data))
            return a;
        try {
            a = Double.valueOf(data);
        } catch (NumberFormatException e) {

        }
        return  a;
    }

    public static boolean isInt(String data){
        try {
            Integer.valueOf(data);
            return  true;
        } catch (NumberFormatException e) {
             return  false;
         }
    }




}
